package com.atjava.webspider.database.support;

import org.apache.commons.lang.StringUtils;

import com.atjava.webspider.database.DataSource;

public class MySQLDataSource extends DataSource{

	private final String MYSQL_DRIVER_CLS = "com.mysql.jdbc.Driver";
	
	public String getDriverCls() {
		return MYSQL_DRIVER_CLS;
	}

	public String getUrl() {
		String url = "jdbc:mysql://" + super.dbPath;
		if(StringUtils.isBlank(super.charset)){
			url = 
				url + 
				"?useUnicode=true&amp;characterEncoding=" + 
				super.charset;
		}
		return url;
	}

	public MySQLDataSource(String dbPath,String username,String passwd){
		super.username = username;
		super.passwd = passwd;
		super.dbPath = dbPath; 
	}
}
